{% extends "base.html" %}
{% load i18n %}
{% load text_utils %}

{% block extrastyle %}
<style type="text/css">
    .highlighted {
        background: yellow;
    }
</style>
{% endblock %} 

{% block bodyclass %}no-dashboard{% endblock %}
{% block coltype %}colMS{% endblock %}
{% block content_title %}
<h1>{% trans "FTB Search" %}</h1>
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="/">{% trans "Home" %}</a> &rsaquo; 
Search
</div>
{% endblock %}

{% block content %}
<div id="content-main">
    <div class="module">
        <table>
            <caption>Results</caption>
            <tr>
                <th>Form</th>
                <th>Lemma</th>
                <th>Cat</th>
                <th>Subcat</th>
                <th>EE</th>
                <th>EI</th>
                <th>Morpho</th>
            </tr>
            {% for aword in results.object_list %}
            <tr class="{% cycle 'row1' 'row2' %}">
                <th>{{ aword.form }}</th>
                <td>{{ aword.lemma }}</td>
                <td>{{ aword.cat }}</td>
                <td>{{ aword.subcat }}</td>
                <td>{{ aword.ee }}</td>
                <td>{{ aword.ei }}</td>
                <td>{{ aword.mph }}</td>
            </tr>
            <tr class="{% cycle 'row1' 'row2' %}">
                <td colspan="7">
                    <h4>Context</h4>
                    <p>{{ aword.sentence.text|highlight:aword.form|safe }}</p> <a href="{{ aword.sentence.get_absolute_url }}">view<a/></td>
            </tr>
            {% empty %}
                <tr><td colspan="7">{% trans "Sory, no result found" %}</td></tr>
            {% endfor %}
        </table>
        <div class="pagination">
            <span class="step-links">
                {% if results.has_previous %}
                    <a href="?q={{ query_string }}&amp;page={{ results.previous_page_number }}">previous</a>
                {% endif %}
                <span class="current">
                    Page {{ results.number }} of {{ results.paginator.num_pages }}.
                </span>
                {% if results.has_next %}
                    <a href="?q={{ query_string }}&amp;page={{ results.next_page_number }}">next</a>
                {% endif %}
            </span>
        </div>
        <div></div>
    </div>
</div>
<div id="content-related">

  <div class="module">
    <h2>Search</h2>
    <form action="/search/" method="GET">
      <p>
    <input type="text" name="q" value="{{ query_string }}" />
    <input type="submit" value="Search" />
      </p>
    </form>
  </div>
</div>
{% endblock %}
